home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _WQUERY_HPP_INCLUDED
- #define _WQUERY_HPP_INCLUDED
-
- //-----------------------------------------------------------------------
- //
- // SQL Query object.
- //
- // The query object is patterned on the ODBC model. The simplest way
- // to use it is as follows:
- //
- // WQuery query;
- //
- // query.Create( &transObject );
- // query.SetSQLStatement( "select * from table" );
- //
- // if( query.Open() ){
- // query.Close();
- // }
- //
- // The query object will only work when attached to a transaction object.
- // The transaction object must be connected to a database for most of
- // the methods to work.
- //
- //-----------------------------------------------------------------------
-
- /*************************************************************************
- *
- * Events:
- *
- * AdjustCursor --
- *
- * BeginFetchData --
- *
- * BeginMoveCursor --
- *
- * DatabaseError --
- *
- * FetchData --
- *
- * MoveCursor --
- *
- * QueryBusy --
- *
- * QueryClose --
- *
- * QueryOpen --
- *
- * QueryPrepare --
- *
- * ValidateData --
- *
- ************************************************************************/
-
- #ifndef _WDATASRC_HPP_INCLUDED
- #include "wdatasrc.hpp"
- #endif
- #ifndef _WDATAERR_HPP_INCLUDED
- #include "wdataerr.hpp"
- #endif
-
- class WTransaction;
- class WQuery;
-
- //
- // BindPolicy
- //
- // Determines the policy the query object uses to bind the various
- // columns. The policy applies to columns that are not explicitly
- // bound by the user or by any bound controls:
- //
- // All -- Bind all columns below a size threshhold
- // Minimal -- If column "n" is bound, make sure columns 1 to n-1 are
- // bound.
- // None -- Do not do any default binding.
-
- enum WQueryBindPolicy {
- WQBPAll,
- WQBPMinimal,
- WQBPNone
- };
-
- //
- // UpdatePolicy
- //
- // This policy determines the type of action to perform an update.
- //
- // Auto -- The query object determines which type to use.
- // Direct -- Directly updates the current row by using driver specific
- // functions if it's supported. i.e. in ODBC, SQLSetPos()
- // Cursor -- Open another query to execute a statement of type
- // UPDATE .... SET .... WHERE CURRENT OF <cursorname>
- // if it's supported.
- // UserDefine -- The user defines an event handler for the ValidateData
- // event and writes their own code to perform the update.
- //
-
- enum WQueryUpdatePolicy {
- WQUPAuto,
- WQUPDirect,
- WQUPCursor,
- WQUPUserDefine
- };
-
- enum WQueryCursorType {
- WQCTForwardOnly = SQL_CURSOR_FORWARD_ONLY,
- WQCTKeysetDriven = SQL_CURSOR_KEYSET_DRIVEN,
- WQCTDynamic = SQL_CURSOR_DYNAMIC,
- WQCTStatic = SQL_CURSOR_STATIC
- };
-
- enum WQueryConcurrencyLevel {
- WQCLReadOnly = SQL_CONCUR_READ_ONLY,
- WQCLLock = SQL_CONCUR_LOCK,
- WQCLOptimisticByRowVer = SQL_CONCUR_ROWVER,
- WQCLOptimisticByValues = SQL_CONCUR_VALUES
- };
-
- enum WQueryParameterType {
- WQPTInput = SQL_PARAM_INPUT,
- WQPTInputOutput = SQL_PARAM_INPUT_OUTPUT,
- WQPTOutput = SQL_PARAM_OUTPUT
- };
-
- enum WQOption {
-
- // These are defined by ODBC
-
- WQOCursorType = SQL_CURSOR_TYPE,
- WQORowsetSize = SQL_ROWSET_SIZE,
- WQOMaxLength = SQL_MAX_LENGTH,
- WQOConcurrency = SQL_CONCURRENCY,
- WQORetrieveData = SQL_RETRIEVE_DATA,
- WQOUseBookmarks = SQL_USE_BOOKMARKS,
- WQOKeysetSize = SQL_KEYSET_SIZE,
- WQOMaxRows = SQL_MAX_ROWS,
- WQOQueryTimeout = SQL_QUERY_TIMEOUT,
-
- // These are our own...
-
- WQOFirstNonODBC = 65536,
-
- WQOAutoPrepare,
- WQOBindPolicy,
- WQOBindLimit,
- WQOAlwaysFetchOptions,
- WQOAlwaysFetchRowPosition,
- WQOAlwaysMoveCursor,
- };
-
- enum WStmtCompare {
- WSMLike = 0,
- WSMNotLike,
- WSMEqual,
- WSMNotEqual,
- WSMLessThan,
- WSMGreaterThan,
- WSMLessThanEqual,
- WSMGreaterThanEqual,
- };
-
- enum WStmtCondition {
- WSNAnd = 0,
- WSNOr,
- };
-
- //
- // State information
- //
-
- #define WQDRSTATE_OPENED 0x01
- #define WQDRSTATE_PREPARED 0x02
- #define WQDRSTATE_NOTFETCHED 0x04
- #define WQDRSTATE_NOTBOUND 0x08
- #define WQDRSTATE_NOTALLOCATED 0x10
- #define WQDRSTATE_NOTDATAOPEN 0x20
-
- enum WODBCStmtHandle { NULLHSTMT = 0, LASTHSTMT = LAST_32BIT };
-
- //
- // WICursorProxy
- //
-
- class WQueryICursor;
-
- class WCMCLASS WICursorProxyBase : public WReferenceObject {
-
- WDeclareSubclass( WICursorProxyBase, WReferenceObject );
-
- protected:
- WICursorProxyBase( const WICursorProxyBase & ref );
- WICursorProxyBase& operator=( const WICursorProxyBase & ref );
-
- protected:
- WICursorProxyBase();
-
- public:
- virtual ~WICursorProxyBase();
-
- virtual WBool DetachQuery( WQuery * ) = 0;
- };
-
- //
- // WQuery -- Represents the results of a SQL statement.
- //
-
- class WCMCLASS WQuery : public WDataSource {
-
- WDeclareSubclass( WQuery, WDataSource );
-
- public:
-
- WQuery();
-
- virtual ~WQuery();
-
-
-
- /***************************************************************
- * Properties
- ***************************************************************/
-
- // AlwaysFetchOptions
- //
- // If TRUE, the query object always asks the database for
- // the state of a particular option. If FALSE it uses the
- // value from its own cache. If options are being set directly
- // by bypassing the query object you should set this to TRUE.
- // FALSE by default.
-
- virtual WBool GetAlwaysFetchOptions() const;
- virtual WBool SetAlwaysFetchOptions( WBool always );
-
- // AlwaysFetchRowPosition
- //
- // If TRUE, the query object always asks the database for
- // the current row position after each fetch. Otherwise
- // the query object maintains its own count, which may not
- // be accurate if bookmarks are being used. Because this
- // adds overhead, it is FALSE by default. Also, not all
- // database drivers support this capability.
-
- virtual WBool GetAlwaysFetchRowPosition() const;
- virtual WBool SetAlwaysFetchRowPosition( WBool always );
-
- // AlwaysMoveCursor
- //
- // If TRUE, the query object always notifies the database
- // whenever the cursor is moved within the current rowset.
- // If FALSE, the database is only notified when necessary
- // (to get BLOB data, for example). Default is FALSE.
-
- virtual WBool GetAlwaysMoveCursor() const;
- virtual WBool SetAlwaysMoveCursor( WBool always );
-
- // AutoPrepare
- //
- // If TRUE, the Prepare method will be called automatically
- // the first time a SQL statement is opened.
-
- virtual WBool GetAutoPrepare() const;
- virtual WBool SetAutoPrepare( WBool on );
-
- // BindPolicy
- //
- // The bind policy for default column binding.
-
- virtual WQueryBindPolicy GetBindPolicy() const;
- virtual WBool SetBindPolicy( WQueryBindPolicy policy );
-
- // BindLimit
- //
- // The maximum size which a character or binary column can be
- // to be bindable. A value of 0 means no limits.
-
- virtual WULong GetBindLimit() const;
- virtual WBool SetBindLimit( WULong limit );
-
- // ConcurrencyLevel
- //
- // The concurrency level for the query. Can only be set
- // if the query is not open. The default is read-only.
-
- virtual WQueryConcurrencyLevel GetConcurrencyLevel() const;
- virtual WBool SetConcurrencyLevel( WQueryConcurrencyLevel l );
-
- // CurrentOffset
- //
- // Returns the offset of the current row within the rowset
- // buffer, a value from 0 to RowsetSize-1.
-
- virtual WLong GetCurrentOffset() const;
-
- // CursorName
- //
- // The name of the cursor. If none is specified,
- // it is generated automatically.
-
- virtual WString GetCursorName() const;
- virtual WBool SetCursorName( const WString & str );
-
- // CursorType
- //
- // Return the cursor type.
-
- virtual WQueryCursorType GetCursorType() const;
- virtual WBool SetCursorType( WQueryCursorType type );
-
- // DisplayErrorDialog
- //
- // When an error occurs, display a dialog describing the
- // error. TRUE by default.
-
- virtual WBool GetDisplayErrorDialog() const;
- virtual WBool SetDisplayErrorDialog( WBool display );
-
- // DisplayWarningDialog
- //
- // When a warning occurs, display a dialog describing the
- // warning. FALSE by default.
-
- virtual WBool GetDisplayWarningDialog() const;
- virtual WBool SetDisplayWarningDialog( WBool display );
-
- // DriverPacksRows
- //
- // Set to true if the underlying query driver packs inserted and
- // deleted rows.
-
- virtual WBool GetDriverPacksRows() const;
- virtual WBool SetDriverPacksRows( WBool packsRows );
-
- // ErrorList
- //
- // Returns the list of errors from the last operation.
-
- virtual WDataErrorArray GetErrorList() const;
-
- // FetchedRows
- //
- // Returns the number of rows that were actually fetched.
- // Can be 0 (none) up to RowsetSize.
-
- virtual WLong GetFetchedRows() const;
-
- // Handle
- //
- // Returns a handle, which is driver-specific. After a
- // valid Create, should be non-zero. After a Destroy,
- // should be zero.
-
- virtual WDWord GetHandle() const;
- virtual WBool SetHandle( WDWord handle );
-
- // KeysetSize
- //
- // Determines the keyset size for keyset-driven cursors.
- // The default is 0, which means a fully keyset-driven
- // cursor, otherwise the cursor is mixed. The keyset
- // size must be greater than the rowset size.
-
- virtual WLong GetKeysetSize() const;
- virtual WBool SetKeysetSize( WLong size );
-
- // LongColumnBindSize
- //
- // Sets the amount of memory to allocate for LONGVARCHAR
- // and LONGVARBINARY columns if a buffer size of 0 is
- // passed to BindColumn. The default is 0, which means
- // that long columns are never bound. Any other value is
- // the maximum amount of data that can be set or gotten
- // from the column, up to the BindLimit property.
-
- virtual WULong GetLongColumnBindSize() const;
- virtual WBool SetLongColumnBindSize( WULong size );
-
- // MaxLength
- //
- // The maximum of binary or character data that can be
- // fetched in a single call. The default value is 0,
- // which means return as much as possible. The maximum
- // value for this property is 64K (=65536 bytes). Note
- // that the MaxLength property affects the amount of
- // data returned by GetRawData.
-
- virtual WULong GetMaxLength() const;
- virtual WBool SetMaxLength( WULong maxLength );
-
- // MaxRows
- //
- // The maximum number of rows to return in a result set.
- // If 0, all rows are returned.
-
- virtual WULong GetMaxRows() const;
- virtual WBool SetMaxRows( WULong maxRows );
-
- // Parameter
- //
- // Defines a parameter value for use in parameterized
- // queries. Setting a parameter will implicitly cause
- // the BindParameter method to be called. Parameters
- // are numbered starting at 1. Can optionally declare
- // whether the parameter should be input, input/output
- // or output only.
-
- virtual WDataValue GetParameter( WShort paramNo ) const;
- virtual WBool SetParameter( WShort paramNo,
- const WDataValue & val,
- WColumnDataType sqlType=SQL_TYPE_NULL,
- WQueryParameterType type=WQPTInput,
- SDWORD maxSize=0 );
-
- // Prepared
- //
- // Returns TRUE if the statement has been prepared for execution.
-
- virtual WBool GetPrepared() const;
-
- // QueryObject
- //
- // Returns the "real" query object that is being used
- // to communicate with the database, which may or
- // may not == this.
-
- WQuery *GetQueryObject() const
- { return _queryDriver ? _queryDriver : (WQuery *) this; }
-
- // QueryTimeout
- //
- // Defines the time in seconds to wait for a statement
- // to execute. The default is 0, which means wait
- // indefinitely.
-
- virtual WULong GetQueryTimeout() const;
- virtual WBool SetQueryTimeout( WULong seconds );
-
- // RetrieveData
- //
- // If FALSE, no data is actually retrieved when a fetch
- // is done. Use this to move around through the data
- // to get bookmarks, etc. Default is TRUE. Can only be
- // set at run time.
-
- virtual WBool GetRetrieveData() const;
- virtual WBool SetRetrieveData( WBool ret );
-
- // RowsetSize
- //
- // The maximum number of rows that are buffered locally by the
- // query object. Setting the rowset size automatically
- // unbinds any bound columns.
-
- virtual WLong GetRowsetSize() const;
- virtual WBool SetRowsetSize( WLong size );
-
- // RowsetStatus
- //
- // Returns the status of a row in the current rowset. Rows
- // are numbered from 1 to n (where n = GetRowsetSize() ).
-
- virtual UWORD GetRowsetStatus( WLong row=1 ) const;
-
- // SQL
- //
- // Stores the SQL statement to be executed. Setting a new
- // statement closes the current query (if open).
-
- virtual WString GetSQL() const;
- virtual WBool SetSQL( const WString & str );
-
- // State
- //
- // Return the current state of the query.
-
- virtual WDWord GetState() const;
-
- // TraceToLog
- //
- // In debug mode, if TRUE traces important actions
- // to the debug log. Has no effect for release mode
- // applications. (This is not the same as the ODBC
- // trace log.)
-
- virtual WBool GetTraceToLog() const;
- virtual WBool SetTraceToLog( WBool on );
-
- // TransactionObject
- //
- // The transaction object to use.
-
- virtual WTransaction *GetTransactionObject() const;
- virtual WBool SetTransactionObject( WTransaction *obj );
-
- // UpdatePolicy
- //
- // The update policy for the type of action to take when
- // updating.
-
- virtual WQueryUpdatePolicy GetUpdatePolicy() const;
- virtual WBool SetUpdatePolicy( WQueryUpdatePolicy policy );
-
- // UseBookmarks
- //
- // If TRUE, bookmarks can be used. Must be set before
- // the cursor is opened. Default is FALSE.
-
- virtual WBool GetUseBookmarks() const;
- virtual WBool SetUseBookmarks( WBool use );
-
- // UseDefaultBindTypes
- //
- // If TRUE, BindColumn is called with SQL_C_DEFAULT when
- // a column is bound by a data target. If FALSE, the
- // type suggested by the data target is used instead. This
- // controls who does the conversion between data types: the
- // database driver or the WDataValue class. Calls to
- // BindColumn by the user are not affected.
-
- virtual WBool GetUseDefaultBindTypes() const;
- virtual WBool SetUseDefaultBindTypes( WBool use );
-
- /***************************************************************
- * Methods
- ***************************************************************/
-
- // AddSearchParameter
- //
- // Add a search parameter to the current query. The query must
- // be open if you want to specify a column index instead of a
- // column name.
-
- virtual WBool AddSearchParameter( const WString & columnName, WDataValue value,
- WStmtCondition=WSNAnd,WStmtCompare compare=WSMLike);
- virtual WBool AddSearchParameter( WShort columnIndex, WDataValue value,
- WStmtCondition=WSNAnd,WStmtCompare compare=WSMLike);
-
- // BindColumn
- //
- // Bind a column in the current query, which must be open.
- // By default it will allocate internal storage for the binding
- // based on the type of the column and the rowset size as
- // well as an array for storing the actual length of retrieved
- // data. The user can provide alternates for any of these.
-
- virtual WBool BindColumn( WShort column, WNativeDataType type=SQL_C_DEFAULT,
- void *arrayStart=NULL, SDWORD elementSize=0,
- SDWORD *lengthArray=NULL );
-
- // BindParameter
- //
- // Bind a parameter for execution with the next query.
- // In most cases you call SetParameter instead of this method,
- // and the binding will be done automatically for you.
- // This method provides low-level access to the binding
- // process. Parameters start at 1.
-
- virtual WBool BindParameter( WShort paramNo, WQueryParameterType type,
- WNativeDataType cType,
- WColumnDataType sqlType,
- UDWORD precision, SWORD scale,
- void *dataBuffer, SDWORD maxSize,
- SDWORD *actualLength );
-
- // BoundControlSearch
- // Opens a new result set given the search parameters from
- // changed bound controls.
-
- virtual WBool BoundControlSearch( WStmtCondition condition=WSNAnd,
- WStmtCompare compare=WSMLike);
- // Clone
- //
- // Allocates and returns a "clone" of the query object.
- // The clone is a semi-independent query object needed
- // for use with complex OCX data binding.
-
- virtual WQuery *Clone();
-
- // Close
- //
- // Close the current query, if any.
-
- virtual WBool Close( WBool discardResults=TRUE,
- WBool isRequery=FALSE );
-
- // Create
- //
- // Calls SetTransactionObject and then checks to see if
- // the transaction object is ready for use.
-
- virtual WBool Create( WTransaction *trans );
-
- // DeleteSearchParameters
- //
- // Deletes the search parameters added to the current query
-
- virtual WBool DeleteSearchParameters();
-
- // Destroy
-
- virtual WBool Destroy();
-
- // Execute
- //
- // Execute a non-select SQL statement. Closes the current
- // query, if any. If an empty or null string is passed in, simply
- // executes the string in the SQL property.
-
- virtual WBool Execute( const WString & stmt=WString::GetNullString() );
-
- // Fetch
- //
- // Fetch a rowset of data from the database.
-
- virtual WBool Fetch( WLong row, WBool notifyTargets=TRUE,
- WDSMoveType type=WDSMoveAbsolute,
- WBool triggerEvents=TRUE );
-
- // FetchBookmark
- //
- // Fetch to a bookmark.
-
- WBool FetchBookmark( WDWord bookmark, WBool notify=TRUE,
- WBool triggerEvents=TRUE );
-
- // FetchErrors
- //
- // Clear the current error list and fetch errors from the
- // driver for later retrieval with
- // GetErrorList. Note that this function is called automatically
- // by most of the other methods, so you should only call it
- // after directly invoking an operation on the driver.
- // You pass in the return code and function code of the
- // last operation. Returns TRUE if messages were fetched
- // from the driver.
-
- virtual WBool FetchErrors( WLong errorCode, WLong funcCode );
-
- // FetchFirst
- //
- // Fetch to the first row.
-
- WBool FetchFirst( WBool notifyTargets=TRUE, WBool triggerEvents=TRUE );
-
- // FetchLast
- //
- // Fetch to the last row.
-
- WBool FetchLast( WBool notifyTargets=TRUE, WBool triggerEvents=TRUE );
-
- // FetchNext
- //
- // Fetch to the next row.
-
- WBool FetchNext( WBool notifyTargets=TRUE, WBool triggerEvents=TRUE );
-
- // FetchPrevious
- //
- // Fetch to the previous row.
-
- WBool FetchPrevious( WBool notifyTargets=TRUE, WBool triggerEvents=TRUE );
-
- // FetchRelative
- //
- // Fetch to a relative row.
-
- WBool FetchRelative( WLong offset, WBool notifyTargets=TRUE,
- WBool triggerEvents=TRUE );
-
- // FlushUnboundValues
- //
- // Flushes the unbound value cache. When data is fetched from
- // an unbound column, a copy is kept in memory. This method
- // frees any copies currently in memory. It is called implicitly
- // whenever a move occurs.
-
- virtual WBool FlushUnboundValues();
-
- // MarkColumnForUpdate
- //
- // After entering add/edit mode, call this method before
- // calling Update if you wish to manually set the length
- // field of a bound column so that it will be updated.
- // Otherwise the length field is set to SQL_IGNORE unless
- // you call SetValue for that column. Returns success.
-
- virtual WBool MarkColumnForUpdate( WShort column, WBool mark );
-
- // Open
- //
- // Execute the SQL statement and open the result set for
- // processing.
-
- virtual WBool Open( WBool executeStatement=TRUE,
- WBool isRequery=FALSE );
-
- // Prepare
- //
- // Prepare the SQL statement for execution. Call this
- // if you intend to execute the same SQL statement multiple
- // times. Closes any open query.
-
- virtual WBool Prepare();
-
- // QueryColumnBinding
- //
- // Return information on how a column is bound. Returns TRUE
- // if the column is bound, FALSE otherwise. Can optionally
- // get pointer to data area, element size, etc.
-
- virtual WBool QueryColumnBinding( WShort column,
- WNativeDataType *boundAs=NULL,
- void **arrayStart=NULL,
- SDWORD *elementSize=NULL,
- SDWORD **lengthArray=NULL );
-
- // Reference
- //
- // Bump up the reference count. Only useful for clones.
- // Returns the new reference count.
-
- virtual WLong Reference();
-
- // ResetSearch
- //
- // Resets the search parameters. This is called before using
- // search.
-
- virtual WBool ResetSearch();
-
- // Resubmit
- //
- // Re-executes the SQL statement that was last set using
- // the SQL property. This is equivalent to calling Close
- // and then Open, but is a bit more efficient.
-
- virtual WBool Resubmit( WBool executeStatement=TRUE,
- WBool closeCursor=TRUE );
-
- // Search
- //
- // Opens a new result set given the current query and the added
- // search parameters. This closes the current query and opens
- // a new query based on the added search parameters.
- //
-
- virtual WBool Search();
-
- // Search
- //
- // This form of search is used if only one parameter is to be
- // added to the current query. This closes the current query
- // and opens a new query based on the added parameter.
- //
- virtual WBool Search( WShort columnIndex, WDataValue value,
- WStmtCondition cond=WSNAnd,WStmtCompare compare=WSMLike);
- virtual WBool Search( const WString & columnName, WDataValue value,
- WStmtCondition cond=WSNAnd,WStmtCompare compare=WSMLike);
-
- // UnbindColumn
- //
- // Undo the binding of a column. Pass a negative value
- // to unbind all bound columns.
-
- virtual WBool UnbindColumn( WShort column );
-
- // UnbindParameter
- //
- // Undo the binding of a parameter. Pass a negative value
- // to unbind all parameters.
-
- virtual WBool UnbindParameter( WShort paramNo );
-
- // Unreference
- //
- // Decrements the reference count. Only useful for clones.
- // Returns the new reference count.
-
- virtual WLong Unreference();
-
- /***************************************************************
- * Item Properties
- ***************************************************************/
-
- // NumericOption
- //
- // Set/get a query option.
-
- virtual WLong GetNumericOption( WULong id, WBool *ok=NULL ) const;
- virtual WBool SetNumericOption( WULong id, WLong value );
-
- // OptionID
- //
- // Return the ID associated with an option string. Can also
- // return whether the option is numeric or string. A value of
- // zero means an invalid option.
-
- virtual WULong GetOptionID( const WString & str,
- WBool *isString=NULL ) const;
-
- // StringOption
- //
- // Set/get a query option.
-
- virtual WString GetStringOption( WULong id ) const;
- virtual WBool SetStringOption( WULong id, const WString & str );
-
- /***************************************************************
- * Other
- ***************************************************************/
-
- virtual WICursorProxyBase *GetICursorProxy() const;
- virtual WBool SetICursorProxy( WICursorProxyBase *p );
-
- /***************************************************************
- * Overrides
- ***************************************************************/
-
- WBool AddTarget( WDataTarget *target );
-
- WBool GetAutoEdit() const;
- WBool SetAutoEdit( WBool autoEdit );
-
- WBool GetAutoRefresh() const;
- WBool SetAutoRefresh( WBool autoRefresh );
-
- WBool GetBOF() const;
-
- WDWord GetBookmark() const;
-
- WShort GetColumnCount() const;
-
- const WDataColumn & GetColumn( WShort index ) const;
- const WDataColumn & GetColumn( const WString & name ) const;
-
- WShort GetColumnIndex( const WString & str ) const;
-
- WLong GetCurrentRow() const;
-
- WDSEditMode GetEditMode() const;
-
- WBool GetEmpty() const;
-
- WBool GetEOF() const;
-
- WLong GetErrorCode( WLong *apiCode=NULL ) const;
-
- WBool GetForwardOnly() const;
-
- WBool GetNull() const;
-
- WBool GetOpened() const;
-
- WBool GetRawData( WShort index, WNativeDataType type,
- void *buffer, WLong bufferSize=0,
- WLong *bytesRemaining=NULL ) const;
-
- WBool GetReadOnly() const;
-
- WBool GetRowTargetChanged() const;
- WBool SetRowTargetChanged( WBool changed );
-
- WBool GetRowChanged() const;
- WBool SetRowChanged( WBool changed );
-
- WLong GetRowCount( WBool force=TRUE ) const;
-
- WBool GetTargetsEnabled() const;
- WBool SetTargetsEnabled( WBool enabled );
-
- WBool GetAlwaysReadWriteTargets() const;
- WBool SetAlwaysReadWriteTargets( WBool enabled );
-
- WBool GetThreadSafe() const;
- WBool SetThreadSafe( WBool safe );
-
- WBool Add( WBool copyValues=FALSE, WBool append=FALSE,
- WBool copyIntoBuffer=FALSE );
-
- WBool CancelUpdate( WBool notifyTargets=TRUE );
-
- WBool ClearTargets();
-
- WBool Delete( WBool triggerEvent=TRUE, WBool notifyTargets=TRUE );
-
- WBool Edit();
-
- WBool MoreResults();
-
- WBool Move( WLong row, WBool notifyTargets=TRUE,
- WDSMoveType type=WDSMoveAbsolute, WBool trigger=TRUE );
-
- WBool Refresh();
-
- WBool RefreshTargets( WBool multiRow=FALSE );
-
- WBool RestoreState( const WDataSourceState state, WBool restore=TRUE );
-
- WBool SaveState( WDataSourceState & state );
-
- WBool SearchUsingTargets() { return BoundControlSearch(); }
-
- WBool ThreadLock( WBool wait=TRUE, WDWord timeout=0xFFFFFFFF );
-
- WBool ThreadUnlock();
-
- WBool Update( WBool triggerEvent=TRUE, WBool notifyTargets=TRUE );
-
- WDataValue GetValue( WShort index, WNativeDataType type=SQL_C_DEFAULT ) const;
- WBool SetValue( WShort index, const WDataValue & val );
-
- /***************************************************************
- * Deprecated
- ***************************************************************/
-
- virtual WBool GetErrorInfo( WString *errorMessage,
- WString *state=NULL,
- WLong *nativeErrorCode=NULL ) const;
-
- /***************************************************************
- * Internal
- ***************************************************************/
-
- public:
-
- virtual WBool CountRows( WBool ensureValid=TRUE );
- virtual WBool CopySettingsToDriver( WBool assumeDefaults );
- virtual WBool TransactionEvent( WEventID id, WEventData *data );
- virtual WBool AddClone( WQuery *clone );
- virtual WBool RemoveClone( WQuery *clone );
-
- protected:
-
- virtual WBool LateBindTarget( WQuery *query, WDataTarget *target );
- virtual void EventNotice( WEventID id, WEventNotice type );
-
- // These are called when the transaction object connects or
- // disconnects from a database. The Connect method gets called
- // before the Connect event, the Disconnect event gets called
- // before the method.
-
- virtual WBool Connect( WEventData *data );
- virtual WBool Disconnect( WEventData *data );
-
- WTransaction *_transaction;
- WQuery *_queryDriver;
- };
-
- class WCMCLASS WQueryFactory : public WObject {
-
- protected:
-
- WQueryFactory();
-
- ~WQueryFactory();
-
- public:
-
- static WQueryFactory *GetFactoryObject();
-
- static WQuery *Allocate( const WString & dbmsName, WQuery *proxy );
-
- static void Register( WQuery * WCMDEF (*func)( const WString &, WQuery * ) );
- static void Deregister( WQuery * WCMDEF (*func)( const WString &, WQuery * ) );
-
- protected:
- wllist_header list;
-
- private:
- static WQueryFactory *_theObject;
- };
-
- #endif
-